#ifndef MAP_H
#define MAP_H

#include <QGraphicsView>
#include <QGraphicsPixmapItem>
#include <QWheelEvent>
#include <QGestureEvent>
#include <QScrollBar>
#include <QMessageBox>
#include <QPrinter>
#include <QRect>
#include <QDebug>
#include "math.h"

class Map : public QGraphicsView
{
    Q_OBJECT
private:
    int zoom, zoom_min, zoom_max;
    void main_init();
    bool gestureEvent(QGestureEvent *event);
    void adjustCenter();
public:
    void init(int zoom_min = 1, int zoom_max = 5);
    explicit Map(QWidget *parent = 0);
    Map(int zoom_min, int zoom_max, QWidget *parent = 0);
    int get_zoom(){return zoom;}
    void update_map();
    void Move(int x, int y);
signals:
    void update();
public slots:
    void set_zoom(int z){this->zoom = z; update_map();}
    void print();
protected:
    void wheelEvent ( QWheelEvent * event );
    void mouseDoubleClickEvent ( QMouseEvent * event );
    void mousePressEvent ( QMouseEvent * event );
    void mouseReleaseEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    bool event(QEvent *event);
    int oldX, oldY;
    bool dragging;
};

#endif // MAP_H
